//
//  AY_BookDHeaderView.m
//  AiYue
//
//  Created by boWen on 2023/11/21.
//

#import "AY_BookDHeaderView.h"

@interface AY_BookDHeaderView ()
@property (nonatomic, strong) UIView * bg_View;
@property (nonatomic, strong) UILabel * bookDNumLabel;
@property (nonatomic, strong) UILabel * bookDLabel;
@end

@implementation AY_BookDHeaderView



- (instancetype)initWithFrame:(CGRect)frame {
    if([super initWithFrame:frame]) {
        self.bg_View = [AYTool createViewWithFrame:CGRectZero andBg:THEME_COLOR andRadius:0.0 andAddSubView:self];
        [self.bg_View mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.bottom.equalTo(self);
        }];
        
        self.bookDNumLabel = [AYTool createLabelWithFrame:CGRectZero andText:nil andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont boldSystemFontOfSize:YNUM(42)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
        [self.bookDNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.bg_View);
            make.top.equalTo(self.bg_View).offset(YNUM(15));
            make.height.mas_offset(YNUM(46));;
        }];
        
        self.bookDLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"会员图书免费看 (书豆 )" andTextColor:COLOR(@"#ffffff") andBgColor:nil andFont:[UIFont boldSystemFontOfSize:YNUM(12)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
        [self.bookDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.bg_View);
            make.top.equalTo(self.bookDNumLabel.mas_bottom).offset(YNUM(6));
            make.height.mas_offset(YNUM(20));
        }];
        
    }
    return self;
}



- (void)setInfoModel:(UserInfo *)infoModel {
    if (kStringIsEmpty(infoModel.beanNum)) {
        self.bookDNumLabel.text = @"0";
    }else {
        self.bookDNumLabel.text = [NSString stringWithFormat:@"%d",infoModel.beanNum.intValue];
    }
}

@end
